<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>创业者服务首页</title>
	<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
	<link rel="stylesheet" type="text/css" href="../css/video-js.css">
	<link rel="stylesheet" href="../css/leftSidebar.css">
</head>
<style type="text/css">
	html,body{height: 100%;}
	.col-xs-12.nav_right{padding: 0;height: 100px;padding-right: 0;margin-right: 0;min-width: 1100px;height: 100px;padding-right: 0;margin-right: 0;padding-left: 160px;}
	#myTab a{color: #7c7c7c; font-size: 15px;}
	#myTab>li.active>a{color: #3f4142; background-color: #fff;}
	.navbar-form{margin-top: 0;}
	.tab_creat .active{color:#6bc50d;}
	.table>tbody>tr.active>td, .table>tbody>tr.active>th, .table>tbody>tr>td.active, .table>tbody>tr>th.active, .table>tfoot>tr.active>td, .table>tfoot>tr.active>th, .table>tfoot>tr>td.active, .table>tfoot>tr>th.active, .table>thead>tr.active>td, .table>thead>tr.active>th, .table>thead>tr>td.active, .table>thead>tr>th.active{background-color: #fff;}
	.table>tfoot>tr.active>td{background-color: #fff;}
	.table>tbody>tr>td{border-top:0;}
	.table{margin-bottom: 0;}
	div.tab_creat.row{background-color: #fff;}
	.tab_font{padding: 10px 0;}
	.tab_font div,.tab_font td{font-size: 14px;color: #919191;}
	.gongsi_list div.col-xs-2,.gongsi_list div.col-xs-1,.gongsi_list div.col-xs-4{text-align: center;padding: 20px 0;}
	.gongsi_list.row{background-color: #fff;margin-top: 20px;}
	.gongsi_list dd div.col-xs-2{font-size: 14px;color: #4f5051;}
	.row{margin: 0;}
	.sub_logo{position: relative;display: inline-block;padding-left: 0;}
	.sub_logo input{opacity: 0;position: absolute;left: 0;right: 0;bottom: 0;top: 0;}
	.zhube_head{border-bottom: 1px solid #ddd;}
	.zhube_head h3{padding: 5px 0;, color: #222c38;font-size: 16px;border-bottom: 4px solid #5a626d;}

	#form_test label{font-size: 14px; color: #515151;font-weight: normal;}
	#form_test  .media-middle{font-size: 14px;color: #acacac;}
	.form_tip{font-size: 12px;color: #acacac; }
	.btn-default{border-color: #d4252a;color: #d4252a;}
	.btn-default.disabled{background-color: #ccc;color: #fff;border-color:#ccc;}
	.btn-default.disabled.focus, .btn-default.disabled:focus, .btn-default.disabled:hover, .btn-default[disabled].focus, .btn-default[disabled]:focus, .btn-default[disabled]:hover, fieldset[disabled] .btn-default.focus, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:hover{background-color: #ccc;color: #fff;}
	.label.label-danger{color: #d5272d;background-color: #ffe6e7 ;font-weight: normal;}
	.media-body p{padding: 20px 0;}
	.xq_bg{background-color: #fff;padding: 20px 0;}

	/*详情界面*/
	#navbar-example{border: 0;background-color: #fff;}
	#navbar-example .nav-pills>li.active>a{border-bottom: 4px solid #d5272d; background-color: #fff;border-radius: 0;color: #222c38;}
	#navbar-example .nav-pills>li>a{font-size: 22px;color: #5a626d;}
	.progress_jieshao h4{font-size: 22px;border-left: 4px solid #222c38;padding: 0 10px;margin-top: 20px;}
	h4>button{float:right;padding: 2px 12px!important;}
	.progress_jieshao p{font-size: 18px;color: #5a626d;line-height: 30px;padding:0 10px;}
	.progress_jieshao section{font-size: 18px;color: #5a626d;padding: 0 10px;}
	.panel_name{font-size: 16px; color: #969fa8;padding: 0 10px;}
	.panne_exp ul>li{margin: 20px 0;}
	.panne_exp ul>li:last-child{margin-top: 10px;}
	.panel-title{font-size: 24px;color: #222c38;font-weight: bold;}
	.extra{padding: 10px 10px 15px 10px;}
	.extra>span:nth-child(1){font-weight: bolder;font-size:16px;margin-right:50px;}
	.extra>span:nth-child(2){color:#969fa8;margin-right:50px;}
	.extra>span:nth-child(3){color:#6bc50d;}
	.star{margin: 10px 0px;}
	.star>span{color:#969fa8;margin-left: 10px;}
	textarea{width:100%;background:#f5f5f5;border-color: #ddd;padding:20px 10px;}

	#daoshi_list>dd:hover{background-color: #ffe6e7;cursor: pointer}
</style>
<body style="background-color: #f2f2f2;">
<div class="row warp" style="height: 100%;">
	<div class="nav_right_head">
		<a href="../index.html"><img src="../img/roleIndexBg.jpg" onerror="onErrorHandle(this)"/></a>
	</div>
	<!--左侧导航-->
	<div class="col-xs-2 nav_left">
		<div class="creatNav">导师服务</div>
		<div class="creatLoginStatus"><img src="../img/avtar.png"><a>您好，导师</a></div>
		<div class="list-group" style="padding: 0;">
			<a href="daoshi_index.html" class="list-group-item active"><i class="glyphicon glyphicon-home"></i> 首页</a>
			<!--<a href="daoshirenzheng_1.html" class="list-group-item"><i class="glyphicon glyphicon-education"></i> 导师认证</a>-->
			<a href="daoshi_yxxm.html" class="list-group-item"><i class="glyphicon glyphicon-folder-open"></i> 已选项目</a>
			<a href="daoshi_gzxm.html" class="list-group-item"><i class="glyphicon glyphicon-question-sign"></i> 关注项目</a>
			<a href="daoshi_mynews.html" class="list-group-item" ><i class="glyphicon glyphicon-book"></i>  我的消息</a>
			<a href="daoshi_lingyudongtai.html" class="list-group-item"><i class="glyphicon glyphicon-send"></i> 领域动态</a>
		</div>
		<div class="backBtn"> <a href="../index.html"><img src="../img/backIndex.png"></a></div>
	</div>
	<div class="col-xs-12 nav_right">


		<div class="row">
			<div class="xq_bg" style="">

				<div class="row">
					<div class="col-xs-6 col-xs-offset-1">
						<div class="media">
							<div class="media-left">
								<a href="#">
									<img class="media-object Pblogo" src="../img/020.jpg" onerror="onErrorHandle(this)" style="width: 140px;height: 140px;" alt="">
								</a>
							</div>
							<div class="media-body pbIntroduce">
								<h4 class="media-heading" style="padding-top: 20px;">小橙科技 <small>互联网·广东省·2006年</small></h4>
								<p>移动互联网创业平台</p>


							</div>
						</div>
					</div>

					<div class="col-xs-3 col-xs-offset-1" style="padding-right: 0;">
						<div class="panel panel-default">
							<div class="panel-heading text-center">上轮获投</div>
							<dl class="text-center row" style="padding: 10px;">
								<dt><div class="col-xs-6">C轮</div><div class="col-xs-6">￥2000万</div></dt>
								<dd><div class="col-xs-6">轮次</div><div class="col-xs-6">金额</div></dd>
							</dl>
						</div>
					</div>
				</div>
			</div>
		</div>

		<nav id="navbar-example" class="navbar navbar-default navbar-static" role="navigation">
			<div class="row">
				<div class="bs-js-navbar-scrollspy col-xs-10 col-xs-offset-1">
					<ul class="nav nav-pills navbar-left">
						<li class="active"><a href="#introduce">项目介绍</a></li>
						<li><a href="#experience">融资经历</a></li>
						<li><a href="#suggest">导师建议</a></li>
						<li><a href="#progress">相似项目</a></li>
					</ul>
					<div class="navbar-right">
						<button class="btn btn-default attentionPb">关注</button>
						<button class="btn btn-default claim">认领</button>
						<button class="btn btn-default">推荐给导师</button>
					</div>

				</div>

			</div>

		</nav>

		<div class="col-xs-10 col-xs-offset-1">

			<div data-spy="scroll" data-target="#navbar-example" data-offset="0"
				 style=" position: relative;">
				<div class="panel panel-default progress_jieshao">
					<div class="panel-heading">
						<h3 class="panel-title" id="introduce">项目介绍 <small>（非熠星项目）</small> <small>（审核已通过）</small></h3>
					</div>
					<div class="panel-body">
						<ul class="list-unstyled " id="pbDetailList">
							<li>
								<h4>概述</h4>
								<p>使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。</p>
								<div class="panel_name">公司全称：<span>小橙科技有限公司</span></div>
							</li>
							<li>
								<h4>详细介绍</h4>
								<section>产品服务</section>
								<p>使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。</p>
							</li>
							<li>
								<h4>团队人数</h4>
								<section>5</section>
							</li>
							<li>
								<h4>技术关键字</h4>
								<section> 大数据</section>
							</li>
							<li>
								<h4>融资阶段</h4>
								<section>未融资</section>
							</li>
							<li>
								<h4>商业计划书</h4>
								<section> <a href="###">点击下载</a></section>
							</li>
						</ul>



					</div>
				</div>

				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title" id="experience">融资经历</h3>
					</div>
					<div class="panel-body panne_exp">
						<ul class="row list-unstyled">
							<li class="col-xs-3">
								2017-3-18
							</li>
							<li class="col-xs-3">
								<b>C轮</b>
							</li>
							<li class="col-xs-3" style="">
								<div>投资金额：<span>2000万人民币</span></div>
								<div>投资方：<span>喜中投资基金</span></div>
							</li>
						</ul>
						<ul class="row list-unstyled">
							<li class="col-xs-3">
								2017-3-18
							</li>
							<li class="col-xs-3">
								<b>C轮</b>
							</li>
							<li class="col-xs-3" style="">
								<div>投资金额：<span>2000万人民币</span></div>
								<div>投资方：<span>喜中投资基金</span></div>
							</li>
						</ul>

					</div>
				</div>

				<!-- 导师建议 -->
				<div class="panel panel-default progress_jieshao">
					<div class="panel-heading">
						<h3 class="panel-title" id="suggest">导师建议</h3>
					</div>
					<div class="panel-body">
						<h4>历史评分<button class="btn btn-default " id="saveTutorSuggest">保存</button></h4>
						<ul class="list-unstyled " id="suggestList">
							<li>
								<div class="extra"><span>7.5</span><span>2017-03-02</span><span>导师:陈西军</span></div>
								<p>使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。使用Max是一个自制内容、自运营内容打造自有IP的公司。</p>
							</li>
						</ul>
						<h4>当前评分</h4>
						<p class="star">请给项目打分:<input id="scores" value="" type="number" placeholder="满分10" maxlength="2"/></p>
						<div>
							<textarea name="name" rows="8" cols="80" id="suggestContent" placeholder="请输入您对该项目的意见或建议,1000字以内" style="border: 0"></textarea>
						</div>
					</div>
				</div>

				<!--我的项目-->
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title " id="progress">相关项目</h3>
					</div>
					<div class="panel-body" style="padding: 0;">
						<div class="row gongsi_list">
							<dl style="background-color: #fff;">
								<dt>
								<div class="row">
									<div class="col-xs-4" style="text-align: left;padding-left: 15px;">创业公司</div>
									<div class="col-xs-2">融资阶段</div>
									<div class="col-xs-2">创业领域</div>
									<div class="col-xs-1">导师</div>
									<div class="col-xs-2">过往投资方</div>
									<div class="col-xs-1">操作</div>

								</div>
								</dt>
								<dd>
									<div class="row">
										<div class="col-xs-4" style="padding-top: 10px;">
											<div class="media">
												<div class="media-left media-middle" style="padding: 0px 15px;">
													<img src="../img/carous.png" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/>
												</div>
												<div class="media-body text-left">
													<span style="display: inline-block;margin-top: 10px;">小橙科技</span>

												</div>
											</div>
										</div>

										<div class="col-xs-2">201703024</div>
										<div class="col-xs-2">生活消费</div>
										<div class="col-xs-1">王西军</div>
										<div class="col-xs-2">无</div>
										<div class="col-xs-1">关注</div>


									</div>

								</dd>
								<dd>
									<div class="row">
										<div class="col-xs-4" style="padding-top: 10px;">
											<div class="media">
												<div class="media-left media-middle" style="padding: 0px 15px;">
													<img src="../img/carous.png" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/>
												</div>
												<div class="media-body text-left">
													<span style="display: inline-block;margin-top: 10px;">小橙科技</span>
												</div>
											</div>
										</div>
										<div class="col-xs-2">201703024</div>
										<div class="col-xs-2">生活消费</div>
										<div class="col-xs-1">王西军</div>
										<div class="col-xs-2">无</div>
										<div class="col-xs-1">关注</div>
									</div>
								</dd>

							</dl>

						</div>
					</div>
				</div>


			</div>

		</div>

	</div>
</div>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">请选择导师</h4>
			</div>
			<div class="modal-body">

				<div class="row gongsi_list">
					<dl style="background-color: #fff;">
						<dt>
						<div class="row">
							<div class="col-xs-4">导师</div>
							<div class="col-xs-4">地区</div>
							<div class="col-xs-4">研究领域</div>
						</div>
						</dt>
						<!--<dd>-->
							<!--<div class="row">-->
								<!--<div class="col-xs-4" style="padding-top: 10px;">-->
									<!--<div class="media">-->
										<!--<div class="media-left media-middle" style="padding: 0px 15px;">-->
											<!--<img src="../img/11.jpg" style="width: 40px;height: 40px;"/>-->
										<!--</div>-->
										<!--<div class="media-body text-left">-->
											<!--<span style="display: inline-block;margin-top: 10px;"><a href="cyzfw_myProgress_xq.html">无人机</a></span>-->

										<!--</div>-->
									<!--</div>-->
								<!--</div>-->

								<!--<div class="col-xs-2">201703024</div>-->
								<!--<div class="col-xs-2">生活消费</div>-->
								<!--<div class="col-xs-1">陈希东</div>-->
								<!--<div class="col-xs-2">无</div>-->
								<!--<div class="col-xs-1">关注</div>-->


							<!--</div>-->

						<!--</dd>-->
						<div>
							<div id="daoshi_list"></div>
							<ul class="pagination pull-right" id="pageTutor">

							</ul>
						</div>

					</dl>

				</div>


			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>
</body>
<script src="../js/jquery-2.1.1.min.js"></script>
<script src="../js/jquery.media.js"></script>
<script src="../js/videojs-ie8.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
<script type="text/javascript" src="../js/bootstrap-paginator.min.js"></script>
<script type="text/javascript" src="../js/public.js"></script>
<script type="text/javascript">

	var person = JSON.parse(sessionStorage.getItem("person"));
	if (person==''||person==null) {
		alert('请先登录')
		window.location.href='denglu.html';
	} else{
		var userId = person.userid;
	}






	var id = location.href.split('?')[1];
	console.log(id)
	//我的项目列表
	$.ajax({
		type: "get",
		url:"http://114.112.96.184:18080/view/pb/"+id,
		data:{'userId':userId},
		error: function(request) {
			console.log("Connection error");
		},
		success: function(data) {
			console.log(data)
			var objPb = data.result.pb;
			var createTime='';
			createTime=objPb.createTime.substring(0,4);
			$('.Pblogo').attr('src',objPb.logo);
			var pbName =''+objPb.pbName+' <small>'+objPb.area+'·'+createTime+'</small>'
			$('.media-body.pbIntroduce h4').html(pbName);
			$('.media-body.pbIntroduce p').html(objPb.company);

			var field = objPb.domain.split(',');
			var fieldHtlm = '';
			for(i=0;i<field.length;i++){
				fieldHtlm+=  '<span class="label label-danger">'+ field[i]+'</span>'
			}
			$('.media-body.pbIntroduce').append(fieldHtlm)

			var yixing='';
			if (objPb.yixing==1){
				yixing='熠星项目'
			}else {
				yixing='非熠星项目'
			}
			$('#introduce small:eq(0)').html(yixing);
            var optionBtn = '';
			var status='';
			if (objPb.status==0){
				status='正在审核中'
			}else if(objPb.status==-1){
				status='审核失败'
			}else{
				status='审核通过'
			}
			var attention='';
			if (objPb.attention==true) {
				attention='取消关注'
			} else{
				attention='关注'
			}
			var claim = '';
			if(objPb.claim==0){
				claim = '认领'
			}else if(objPb.claim==3){
				claim= '已认领'
			}else if(objPb.claim==2){
                claim= '认领中'
			}else {
				claim = '认领'
			}

			optionBtn =  '<button class="btn btn-default attentionPb" optionType="attentionPb">'+attention+'</button> <button class="btn btn-default claim" optionType="claim" >'+claim+'</button> <button class="btn btn-default recommendTutor" optionType="recommendTutor" data-toggle="modal" data-target="#myModal" >推荐给导师</button> <button class="btn btn-default recommendInvest" optionType="recommendInvest">推荐给投资人</button> <button class="btn btn-default pbRipe" optionType="pbRipe">项目成熟</button>';

			$('.navbar-right').html(optionBtn)
			$('.recommendInvest,.pbRipe').hide();
			if(objPb.claim=='2'){
				$('.recommendTutor').hide();
			}else if(objPb.claim=='3'){
				$('.pbRipe').show();
			}
			if ($('.claim').text()=='已认领'||$('.claim').text()=='认领中'){
			$('.recommendTutor,.recommendInvest').hide();
			}
			if ($('.claim').text()=='认领'){
				$('.recommendInvest').hide();
			}
//			if(objPb.status==20){
//				$('.recommendTutor').hide();
//				$('.pbRipe').show();
//			}
			if(objPb.status=='25'){
				$('.pbRipe').hide();
				$('.recommendInvest').show();
			}
//			if(objPb.status=='30'){
//				$('.recommendInvest').text('已推送给投资人');
//			}
			$('#introduce small:eq(1)').html(status);
			var pbDetailContent='';
			pbDetailContent= '<li><h4>概述</h4>'+
					'<p>'+objPb.summary+'</p>'+
					'<div class="panel_name">公司全称：<span>'+objPb.company+'</span></div>'+
					'</li>'+
					'<li><h4>详细介绍</h4><section>产品服务</section>'+
					'<p>'+objPb.synopsis+ '</p>'+
					'</li>'+
					'<li><h4>团队人数</h4>'+
					'<section>'+objPb.personNum+ '</section>'+
					'</li>'+
					'<li> <h4>技术关键字</h4>'+
					'<section>'+ objPb.keyword+ '</section>'+
					'</li>'+
					'<li> <h4>融资阶段</h4>'+
					'<section>'+objPb.financingStage+'</section>'+
					'</li>'+
					'<li class="businessPlan"> <h4>商业计划书</h4>'+
					'<section> <a href="'+ objPb.businessPlan+'" download="">点击下载</a></section>'+
					'</li>'

			if(objPb.pptFile){
				pbDetailContent+='<li class="pptFile"> <h4>熠星ppt介绍</h4>'+
						'<section> <a href="'+ objPb.pptFile+'" >在线查阅</a></section>'+
						'</li>'
			}
			$('.pptFile a').media()

			if(objPb.videoFile){
				pbDetailContent+='<li class="videoFile"> <h4>熠星视频介绍</h4>'+
						'<video id="videoFile" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup="{}">'+
						'<source src="'+objPb.videoFile+'" type="video/mp4" />'+
						'<source src="'+objPb.videoFile+'" type="video/webm"" />'+
						'<source src="'+objPb.videoFile+'" type="video/ogg" />'+
						'<track kind="captions" src="demo.captions.vtt" srclang="en" label="English"/>'+
						'<track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"/>'+
						'</video>'+
						'</li>';
				//视频在线播放
				var myPlayer = videojs('videoFile');
				videojs("videoFile").ready(function(){
					var myPlayer = this;
					myPlayer.play();
				});
			}

			$('#pbDetailList').html(pbDetailContent)
			if(!objPb.company){
				$('.panel_name').hide();
			}

			if(objPb.open==0){
				$('.businessPlan').hide();
			}
		}




	});

	$('.businessPlan a:eq(0)').media();

	function onErrorHandle(obj){
		obj.src="../img/defaultAvatar.png";
	}

	//关注项目
//	$(document).on('click','.attentionPb',function () {
//		if (person==''||person==null) {
//			window.location.href='denglu.html';
//			return;
//		}
//		if ($(this).text()=='我的项目'){
//			return false;
//		}
//
//		if($(this).text()=='关注'){
//			$(this).text('取消关注')
//		}else {
//			$(this).text('关注')
//		}
//		attentionPb();
//		function attentionPb() {
//			$.ajax({
//				type: "post",
//				data:{'userId':userId},
//				url:"http://114.112.96.184:18080/auth/attentionPb/"+id,
//				async: false,
//				error: function(request) {
//					console.log("Connection error");
//				},
//				success: function(data) {
//					console.log(data);
//
//				}
//			});
//		}
//
//	});

	//认领项目
//	$(document).on('click','.claim',function () {
//		if (person==''||person==null) {
//			window.location.href='denglu.html';
//			return;
//		}
//		if($(this).text()=='认领'){
//			$(this).text('取消认领')
//		}else {
//			$(this).text('认领')
//		}
//		claim();
//		function claim() {
//
//			$.ajax({
//				type: "post",
//				data:{'userId':userId},
//				url:"http://114.112.96.184:18080/tutor/pb/"+id,
//				async: false,
//				error: function(request) {
//					console.log("Connection error");
//				},
//				success: function(data) {
//					console.log(data);
//					if(data.code=='000'){
//
//					}else {
//						alert(data.msg);
//					}
//				}
//			});
//		}
//
//	});


	//操作按钮
    $('.navbar-right').on('click','button',function () {
        if (person==''||person==null) {
            window.location.href='denglu.html';
            return;
        }
        var that = $(this);
        var optionType=that.attr('optionType');
        switch(optionType)
        {
            case 'attentionPb':
                attentionPb()
                break;
            case 'claim':
                claim()
                break;
			case 'recommendTutor':
			    break;
            case 'recommendInvest':
                break;
            case 'pbRipe':
				pbRipe()
                break;
            default:

        }
		//关注项目
		function attentionPb() {
			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/auth/attentionPb/"+id,
				async: true,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);
					if(that.text()=='关注'){
						that.text('取消关注')
					}else {
						that.text('关注')
					}

				}
			});
		}
		//认领项目
		function claim() {
			if($('.claim').text()=='认领中'){
					alert('项目正在认领中')
				return
			}
			if($('.claim').text()=='已认领'){
				alert('该项目已被认领')
				return false;
			}

			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/tutor/pb/"+id,
				async: false,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);
					if(data.code=='000'){
						if(that.text()=='认领'){
							that.text('认领中')
							$('.recommendInvest,.pbRipe').hide();
						}
					}else {
						alert(data.msg);
					}
				}
			});
		}
		//导师认定项目成熟
		function pbRipe() {
			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/tutor/"+ id +"/ripe",
				async: true,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);
					that.hide();
//					$('')

				}
			});
		}

		//推送给投资人
		function recommendInvest() {
			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/tutor/"+ id +"/ripe",
				async: true,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);

				}
			});
		}
    });


//推送给导师列表
	getTutorList({'userId':userId},1,10);
	function getTutorList(objs,page,pageSize) {
		objs.index=page;
		objs.size=pageSize;
		$.ajax({
			type: "get",
			data:objs,
			url:"http://114.112.96.184:18080/view/tutors",
			async: false,
			error: function(request) {
				console.log("Connection error");
			},
			success: function(data) {
				console.log(data);
				var pages=Math.ceil(data.result.totalElements/10);
				if(pages<=1){
					$("#pageTutor").hide();
				}else{
					$("#pageTutor").show();
				}
				var options= {
					bootstrapMajorVersion: 3,
					currentPage: page,    //当前页数
					numberOfPages: 10,
					totalPages: pages,    //所有数据可以显示的页数
					tooltipTitles: function () {
					},
					itemTexts: function (type, page, current) {
						switch (type) {
							case "prev":
								return "←上一页";
							case "next":
								return "下一页→";
							case "page":
								return page;
						}
					},
					shouldShowPage: function (type, page, current) {
						switch (type) {
							case "first":
							case "last":
								return false;
							default:
								return true;
						}
					},
					onPageClicked: function (event, originalEvent, type, page) {
						objs.index=page;
						$.ajax({
							type: "get",
							data: {'userId': userId, 'index': page, 'size': pageSize},
							url: "http://114.112.96.184:18080/view/tutors",
							async: false,
							error: function (request) {
								console.log("Connection error");
							},
							success: function (data) {
								var obj = data.result.content;
								var htmls='';
								for (var i = 0; i < obj.length;i++) {
									var attention='';
									var createTime='';
									if (obj[i].attention==true) {
										attention='取消关注'
									} else{
										attention='关注'
									}
									if(obj[i].userId==userId){
										attention='我';
									}
									htmls+= '<dd  tutorId="'+obj[i].id+'">'+
											'<div class="row">'+
											'<div class="col-xs-4" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/>'+ obj[i].realName+'</div>'+
											'<div class="col-xs-4">'+ obj[i].area+'</div>'+
											'<div class="col-xs-4">'+ obj[i].researchField+'</div>'+
											'</div>'+
											'</dd>'
								}
								$('#daoshi_list').html(htmls);
							}
						})


					}
				}

				if(data.result.totalElements>0){
					$("#pageTutor").bootstrapPaginator(options);
				}

				var obj = data.result.content;
				var htmls='';
				for (var i = 0; i < obj.length;i++) {
					var attention='';
					var createTime='';
					if (obj[i].attention==true) {
						attention='取消关注'
					} else{
						attention='关注'
					}
					htmls+= '<dd  tutorId="'+obj[i].id+'">'+
							'<div class="row">'+
							'<div class="col-xs-4" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/> '+ obj[i].realName+'</div>'+
							'<div class="col-xs-4">'+ obj[i].area+'</div>'+
							'<div class="col-xs-4">'+ obj[i].researchField+'</div>'+
							'</div>'+
							'</dd>'
				}
				$('#daoshi_list').html(htmls).on('click','dd',function () {
				var tutorId=$(this).attr('tutorId');
					$.ajax({
						type: "post",
						data: {'userId': userId},
						url: "http://114.112.96.184:18080/tutor/"+id+"/to/"+tutorId,
						async: true,
						error: function (request) {
							console.log("Connection error");
						},
						success: function (data) {
							console.log(data)
							$('#myModal').modal('hide')
							$('.recommendTutor').text('已推荐给导师');
						}

					});



				});

			}
		});
	}



	$('#saveTutorSuggest').on('click',function () {
		var scores ='';
		var suggestContent='';
		console.log($('#scores').val())
		if($('#scores').val()){
			scores=$('#scores').val()
		}else {
			alert('请仔细打分')
			return
		}
		if($('#suggestContent').val()){
			suggestContent=$('#suggestContent').val()
		}else {
			alert('请仔细填写建议')
			return
		}
		var html = '<li>'+
				'<div class="extra"><span>'+scores+'</span><span>2017-03-02</span><span>导师:陈西军</span></div>'+
				'<p>'+ suggestContent +'</p>'+
				'</li>'



		$.ajax({
			type: "post",
			data:{'userId':userId,'score':scores,'comment':suggestContent},
			url:"http://114.112.96.184:18080/tutor/pb/"+id+"/grade",
			async: false,
			error: function(request) {
				console.log("Connection error");
			},
			success: function(data) {
				console.log(data);
				$('#scores').val('');
				$('#suggestContent').val('');
				$('#suggestList').append(html);
			}
		});
	});


</script>
</html>
